<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Comments extends CI_Model {

	function insert($comment){
		$this->db->insert('comments', $comment);
		return true;
	}

	function get_comments($task_id){
		$query=$this->db->query("SELECT c.id,c.task_id, c.timestamp, CONCAT(u.first_name, ' ', u.last_name) as name, c.comment FROM comments as c JOIN  users as u JOIN  tasks as t ON u.id = c.user_id AND t.id = c.task_id WHERE t.id=".$task_id);
		return $query->result();
	}

}

/* End of file comments.php */
/* Location: ./application/models/comments.php */